import 'package:boss/color_constant.dart';
import 'package:boss/provider/staff_provider.dart';
import 'package:boss/ui/page/staff/page/staffDetail/provider/staff_detail_provider.dart';
import 'package:boss/ui/widget/button/radius_button.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'staff_detail_form.dart';

class StaffDetailBrowser extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          StaffDetailForm(),
          Container(
            width: double.infinity,
            decoration: BoxDecoration(
              color: Colors.white,
              boxShadow: [
                BoxShadow(
                  color: ColorConstant.b1b1,
                  blurRadius: 10.w,
                )
              ],
            ),
            padding: EdgeInsets.only(
              top: 20.w,
              left: 80.w,
              right: 80.w,
              bottom: 20.w + MediaQuery.of(context).padding.bottom,
            ),
            child: RadiusButton(
              title: '保 存',
              onTap: () {
                var staffDetailProvider = Provider.of<StaffDetailProvider>(
                  context,
                  listen: false,
                );
                var staffProvider = Provider.of<StaffProvider>(
                  context,
                  listen: false,
                );
                staffProvider.saveOrUpdateStaff(staffDetailProvider.staff);
              },
            ),
          ),
        ],
      ),
    );
  }
}
